package ingsw2.functionality;

import java.util.ArrayList;
import java.util.List;

public abstract class CompositeOrganisationalUnit implements IOrganizationalUnit {
	
	protected List<IOrganizationalUnit> childOrganizationalUnit = new ArrayList<IOrganizationalUnit>();
	
	public void add(IOrganizationalUnit organizationalUnit){
		childOrganizationalUnit.add(organizationalUnit);
	}
	
	public void remove(IOrganizationalUnit organizationalUnit){
		childOrganizationalUnit.remove(organizationalUnit);
	}
	
	@Override
	public void accept(IElementVisitor visitor) {
		for (IOrganizationalUnit e : childOrganizationalUnit){
			e.accept(visitor);
		}
	}
	
}
